package com.test.common.repository.perf;

import com.test.common.entity.perf.PerfResourceEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;
import java.util.Optional;

@Repository
public interface PerfResourceRepository extends JpaRepository<PerfResourceEntity, Integer> {
    Optional<PerfResourceEntity> findByName(String name);

    @Query(nativeQuery = true, value = "SELECT `id`, `name` FROM `t_perf_resource`")
    List<Map<String, Object>> getAllNames();
}
